package com.pinyoumei.app.adapter;

import android.support.annotation.Nullable;
import android.view.ViewGroup;
import android.widget.ImageView;

import com.pinyoumei.app.R;
import com.pinyoumei.app.bean.FirstBean;
import com.bumptech.glide.Glide;
import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.BaseViewHolder;

import java.util.ArrayList;
import java.util.List;

/**
 * Created by Administrator on 2021-08-09.
 * --------- 日期 ------- 维护人 ------------ 变更内容 --------
 * 2021-08-09        Administrator             新增Person类
 * 2021-08-09        Administrator             增加sex属性
 */
public class BottomFirstAdapter extends BaseQuickAdapter<FirstBean.ResultBean.BestGoodsListBean, BaseViewHolder> {


    public BottomFirstAdapter(int layoutResId, @Nullable List<FirstBean.ResultBean.BestGoodsListBean> data) {
        super(layoutResId, data);
    }

    @Override
    protected void convert(BaseViewHolder helper, FirstBean.ResultBean.BestGoodsListBean item) {

        if(helper.getPosition() == 0){
            helper.setImageResource(R.id.iv_bg_luk,R.mipmap.luck_draw_icon);
            helper.setVisible(R.id.iv_bg_luk, true);
            helper.setVisible(R.id.iv_bg, false);
            helper.setVisible(R.id.tv_goods_name, false);
            helper.setVisible(R.id.tv_sale_icon_layout, false);
            helper.setVisible(R.id.tv_sale_price_layout,false);
        }else {
            ImageView iv_pt_goods_img = helper.getView(R.id.iv_bg);
            Glide.with(mContext).load(item.getGoods_img()).into(iv_pt_goods_img);
            helper.setText(R.id.tv_goods_name, item.getGoods_name());
            helper.setText(R.id.tv_sale_price, item.getSale_price() + "");
            helper.setVisible(R.id.iv_bg_luk, false);
            helper.setVisible(R.id.iv_bg, true);
            helper.setVisible(R.id.tv_goods_name, true);
            helper.setVisible(R.id.tv_sale_icon_layout, true);
            helper.setVisible(R.id.tv_sale_price_layout,true);
        }
    }

}
